package com.example.farmeri.ui.users;

import android.content.DialogInterface;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import androidx.appcompat.app.AlertDialog;

import com.example.farmeri.R;
import com.example.farmeri.ui.base.BaseActivity;

import butterknife.BindView;
import butterknife.ButterKnife;


public class AddUsersActivity extends BaseActivity {

    @BindView(R.id.add_user_button)
    Button userAdd;

    //@BindView(R.id.dialog_bottom_cancer)
    //TextView cancer;
    //
    //@BindView(R.id.dialog_bottom_confirm)
    //TextView confirm;

    //@BindView(R.id.dialog_bottom_text)
    //TextView dialog_text;

    private AlertDialog dialog;
//    private TextView dialog_text;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_add_user);
        ButterKnife.bind(this);
        initToolBar(R.id.add_user_toolbar,"添加用户",true,true);
        userAdd.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showDialog();
            }
        });


    }


    /**
     * 显示弹出框
     */
    private void showDialog() {
        if (dialog == null) {
            dialog = new AlertDialog.Builder(this).create();
            dialog.setTitle("提示");
            dialog.setMessage("添加成功");
            dialog.setButton(DialogInterface.BUTTON_POSITIVE, "确定", new DialogInterface.OnClickListener() {
                @Override
                public void onClick(DialogInterface dialog, int which) {
                    finish();
                }
            });
        }
        dialog.show();
    }




}